import logging


def init_log():
    logger = logging.getLogger()
    logger.setLevel(level=logging.INFO)
    if len(logger.handlers) == 0:
        # handler = logging.FileHandler("log.txt")
        handler = logging.StreamHandler()
        handler.setLevel(logging.INFO)
        # pathname
        formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(filename)s:%(lineno)d[%(funcName)s] - %(message)s')
        handler.setFormatter(formatter)
        logger.addHandler(handler)
    return logger